home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 March
/
Ahoy_Magazine_85-03_1985_Double_L.d64
/
mansion game
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
10KB
|
329 lines
1 rem solve the mansion murder--display
2 rem
7 rem
8 rem relocate basic variable storage
9 rem
10 poke 32766,peek(45):poke 32767,peek(46):poke 45,0:poke 46,128
12 rem
13 rem has screen been loaded?
14 rem
15 if peek(31744)=26 and peek(31748)=152 then 20
16 poke 47,0:poke 48,128:poke 49,0:poke 50,128:gosub 50000
20 gosub 1000
27 rem
28 rem move video memory to mansion
29 rem
30 wq=peek(56578):xq=peek(56576):poke 56578,wq or 3:poke 56576,xq and 272 or vm
35 poke vr,dm(0):poke br,db(0):p=0:t=0
40 gosub 450
45 gosub 400:i=fre(9)
97 rem
98 rem movement loop
99 rem
100 vd=vm(peek(197)):hd=hm(peek(653)):if hd=0 and vd=0 then 100
102 rem
103 rem special command handler
104 rem
105 if vd=2 then t=75:goto 180
106 if vd=3 then 800
107 rem
108 rem check where figure will be
109 rem
110 v(p)=v(p)+vd:h(p)=h(p)+hd
111 xc(p)=peek(da(pw(p))+h(p)+40*v(p))-128
112 rem
113 rem is it a secret passage?
114 rem
115 if xc(p)>85 then 600
117 rem
118 rem is it a stair-end?
119 rem
120 if (xc(p)=62 or xc(p)=63) and pr(p)=1 then 300
122 rem
123 rem can object be moved through?
124 rem
125 if xc(p)>61 or xc(p)=0 then v(p)=xv(p):h(p)=xh(p):xc(p)=pr(p):goto 100
126 if v(p)>22 or v(p)<1 then 250
127 rem
128 rem moving off the edge?
129 rem
130 if h(p)>38 or h(p)<1 then 200
131 if v(p)>22 or v(p)<1 then 250
137 rem
138 rem put back old floor,get new
139 rem
140 print v$(xv(p))tab(xh(p))xc$(p);:xc$(p)=ch$(xc(p))
142 rem
143 rem put figure in new spot
144 rem
145 print v$(v(p))tab(h(p))pf$(p);
167 rem
168 rem if new room, print name
169 rem
170 if pr(p)<>xc(p) then gosub 460
177 rem
178 rem is player's turn over?
179 rem
180 t=t+1:if t>75 then gosub 500
190 xh(p)=h(p):xv(p)=v(p):goto 100
197 rem
198 rem horizontal move to new screen
199 rem
200 pq=3:if h(p)<1 then pq=4
205 if pw(p)=w(pw(p),pq) then h(p)=xh(p):v(p)=xv(p):goto 100
210 if h(p)<1 and pw(p)=4 then v(p)=6
211 if h(p)>38 and pw(p)=5 then v(p)=16
215 if h(p)<1 then h(p)=38:goto 270
220 h(p)=1:goto 270
247 rem
248 rem vertical move to new screen
249 rem
250 pq=2:if v(p)<1 then pq=1
255 if pw(p)=w(pw(p),pq) then h(p)=xh(p):v(p)=xv(p):goto 100
260 if v(p)<1 then v(p)=22:goto 270
265 v(p)=1:goto 270
267 rem
268 rem get new screen number
269 rem
270 pw(p)=w(pw(p),pq)
277 rem
278 rem go initialize screen
279 rem
280 gosub 900
290 goto 190
297 rem
298 rem stairway handler
299 rem
300 if pw(p)=11 then pw(p)=6:v(p)=7:h(p)=17:gosub 900:goto 190
310 if pw(p)=8 and xh(p)>12 then pw(p)=0:v(p)=14:h(p)=16:gosub 900:goto 190
315 if pw(p)=8 then pw(p)=2:v(p)=21:h(p)=9:gosub 900:goto 190
320 if pw(p)=7 then pw(p)=1:v(p)=3:h(p)=23:gosub 900:goto 190
330 if pw(p)=6 then pw(p)=11:v(p)=19:h(p)=16:gosub 900:goto 190
340 if pw(p)=5 then pw(p)=1:v(p)=15:h(p)=23:gosub 900:goto 190
350 if pw(p)=4 then pw(p)=2:v(p)=20:h(p)=16:gosub 900:goto 190
360 if pw(p)=2 and xh(p)>12 then pw(p)=4:v(p)=10:h(p)=15:gosub 900:goto 190
365 if pw(p)=2 then pw(p)=8:v(p)=21:h(p)=7:gosub 900:goto 190
370 if pw(p)=1 and xv(p)>9 then pw(p)=5:v(p)=3:h(p)=23:gosub 900:goto 190
375 if pw(p)=1 then pw(p)=7:v(p)=16:h(p)=23:gosub 900:goto 190
380 if pw(p)=0 then pw(p)=8:v(p)=20:h(p)=16:gosub 900:goto 190
390 h(p)=xh(p):v(p)=xv(p):goto 100
397 rem
398 rem un-link screen lines
399 rem
400 for i=217 to 242:poke i,peek(i)or 128:next:return
447 rem
448 rem re-print figures on screen
449 rem
450 for i=0 to np:if pw(i)=pw(p) then print v$(v(i))tab(h(i))pf$(i);
455 next
460 pr(p)=xc(p):print "[146]"v$(24)bl$v$(24)nm$(pr(p))v$(24)tab(27)"player "p+1"";
465 return
497 rem
498 rem change players
499 rem
500 t=0:p=p+1:if p>np then p=0
505 poke br,yq:print "[147]":gosub 400
510 poke br,db(pw(p)):poke vr,dm(pw(p)):print v$(24)bl$;
520 print v$(24)"[146]"nm$(pr(p))v$(24)tab(28)"player "p+1"";
530 for i=0 to 2000:next:poke 197,64:poke 653,0
540 gosub 450:return
597 rem
598 rem move through secret passages
599 rem
600 if pw(p)=3 then pw(p)=10:v(p)=5:h(p)=14:gosub 900:goto 190
601 if pw(p)=10 and h(p)<18 then pw(p)=3:v(p)=22:h(p)=29:gosub 900:goto 190
602 if pw(p)=6 then pw(p)=5:v(p)=10:h(p)=20:gosub 900:goto 190
603 if pw(p)=5 and xh(p)<22 then pw(p)=6:v(p)=3:h(p)=14:gosub 900:goto 190
604 if pw(p)=5 and v(p)<4 then pw(p)=8:v(p)=7:h(p)=5:gosub 900:goto 190
605 if pw(p)=8 and xv(p)=6 then pw(p)=5:v(p)=2:h(p)=37:gosub 900:goto 190
610 on sp goto 620,670,720
615 v(p)=xv(p):h(p)=xh(p):goto 100
620 if pw(p)=11 and pr(p)=52 then pw(p)=8:v(p)=22:h(p)=3:gosub 900:goto 190
621 if pw(p)=11 then pw(p)=11:h(p)=21:gosub 900:goto 190
622 if pw(p)=9 and pr(p)=4 then pw(p)=4:v(p)=8:h(p)=2:gosub 900:goto 190
623 if pw(p)=10 and pr(p)=4 then pw(p)=1:v(p)=13:h(p)=28:gosub 900:goto 190
624 if pw(p)=4 then pw(p)=11:v(p)=8:h(p)=3:gosub 900:goto 190
625 if pw(p)=9 then pw(p)=5:v(p)=9:h(p)=36:gosub 900:goto 190
626 if pw(p)=7 then pw(p)=10:v(p)=6:h(p)=38:gosub 900:goto 190
627 if pw(p)=10 then pw(p)=11:v(p)=6:h(p)=31:gosub 900:goto 190
628 if pw(p)=5 and xh(p)>32 then pw(p)=7:v(p)=6:h(p)=8:gosub 900:goto 190
629 if pw(p)=1 then pw(p)=9:v(p)=16:h(p)=25:gosub 900:goto 190
630 if pw(p)=8 and pr(p)=41 then pw(p)=3:v(p)=5:h(p)=7:gosub 900:goto 190
650 v(p)=xv(p):h(p)=xh(p):goto 100
670 if pw(p)=11 and pr(p)=52 then pw(p)=9:v(p)=2:h(p)=2:gosub 900:goto 190
671 if pw(p)=11 then pw(p)=11:h(p)=21:gosub 900:goto 190
672 if pw(p)=9 and pr(p)=4 then v(p)=13:gosub 900:goto 190
673 if pw(p)=10 and pr(p)=4 then pw(p)=5:v(p)=9:h(p)=37:gosub 900:goto 190
674 if pw(p)=4 then pw(p)=10:v(p)=17:h(p)=12:gosub 900:goto 190
675 if pw(p)=9 then pw(p)=0:v(p)=5:h(p)=16:gosub 900:goto 190
676 if pw(p)=7 then pw(p)=1:v(p)=12:h(p)=27:gosub 900:goto 190
677 if pw(p)=10 then pw(p)=8:v(p)=17:h(p)=2:gosub 900:goto 190
678 if pw(p)=5 and xh(p)>32 then pw(p)=11:v(p)=22:h(p)=27:gosub 900:goto 190
679 if pw(p)=1 then pw(p)=7:v(p)=6:h(p)=12:gosub 900:goto 190
680 if pw(p)=8 and pr(p)=41 then pw(p)=7:v(p)=2:h(p)=27:gosub 900:goto 190
700 v(p)=xv(p):h(p)=xh(p):goto 100
720 if pw(p)=11 and pr(p)=52 then pw(p)=5:v(p)=9:h(p)=37:gosub 900:goto 190
721 if pw(p)=11 then pw(p)=11:h(p)=21:gosub 900:goto 190
722 if pw(p)=9 and pr(p)=4 then pw(p)=7:v(p)=6:h(p)=12:gosub 900:goto 190
723 if pw(p)=10 and pr(p)=4 then v(p)=6:gosub 900:goto 190
724 if pw(p)=4 then pw(p)=9:v(p)=2:h(p)=27:gosub 900:goto 190
725 if pw(p)=9 then pw(p)=8:v(p)=10:h(p)=15:gosub 900:goto 190
726 if pw(p)=7 then pw(p)=10:v(p)=2:h(p)=12:gosub 900:goto 190
727 if pw(p)=10 then pw(p)=9:v(p)=17:h(p)=2:gosub 900:goto 190
728 if pw(p)=5 and xh(p)>32 then pw(p)=8:v(p)=18:h(p)=3:gosub 900:goto 190
729 if pw(p)=1 then pw(p)=4:v(p)=7:h(p)=2:gosub 900:goto 190
730 if pw(p)=8 and pr(p)=41 then pw(p)=11:v(p)=22:h(p)=21:gosub 900:goto 190
750 v(p)=xv(p):h(p)=xh(p):goto 100
797 rem
798 rem ending routine
799 rem
800 poke br,yq:print "[147]do you want to end this game? (y or n)"
805 poke vr,zq:poke 56578,peek(56578)or 3:poke 56576,xq
810 for i=0 to 2000:next:poke 198,0:poke 197,64
820 vd=peek(197):if vd=64 then 820
825 if vd=25 then 850
830 wq=peek(56578):xq=peek(56576):poke 56578,wq or 3:poke 56576,xq and 272 or vm
835 poke vr,dm(pw(p)):poke br,db(pw(p))
840 gosub 450
845 goto 190
850 print "do you want to start a new game? (y or n)"
855 for i=0 to np:poke br,db(pw(i)):print v$(xv(i))tab(xh(i))""xc$(i);:next
860 poke br,yq
865 for i=0 to 2000:next:poke 198,0:poke 197,64
870 vd=peek(197):if vd=64 or (vd<>25 and vd<>39) then 870
875 if vd=25 then gosub 1120:goto 30
890 poke 31744,uq:poke 31748,vq:poke 45,peek(31744):poke 46,peek(31748)
895 poke 792,71:poke 808,237:print "[147]thanks for playing!":clr:end
897 rem
898 rem initialize new screen
899 rem
900 print v$(xv(p))tab(xh(p))xc$(p);
902 rem
903 rem reset color memory
904 rem
905 poke br,yq:print "[147]":gosub 400
907 rem
908 rem get to new screen
909 rem
910 poke vr,dm(pw(p)):poke br,db(pw(p))
912 rem
913 rem get new floor
914 rem
915 xc(p)=peek(da(pw(p))+h(p)+40*v(p))-128:if xc(p)>0 and xc(p)<62 then 930
920 h(p)=h(p)+1+38*(h(p)>37):v(p)=v(p)+1+22*(v(p)>21):goto 915
930 xc$(p)=ch$(xc(p)):gosub 450:return
997 rem
998 rem set up tables
999 rem
1000 dim w(11,6),hm(7),vm(64),mt(2,2),v$(24),ch$(63),nm$(63)
1005 dim v(5),sh(5),h(5),xh(5),xv(5),pw(5),xc(5),pr(5),pf$(5),xc$(5)
1007 rem
1008 rem vertical keystroke table
1009 rem
1010 for i=0 to 64:vm(i)=0:next:vm(6)=-1:vm(3)=1:vm(1)=3:vm(60)=2
1017 rem
1018 rem horizontal keystroke table
1019 rem
1020 for i=0 to 7:hm(i)=0:next:hm(1)=1:hm(2)=-1:hm(3)=-1
1027 rem
1028 rem vertical print table
1029 rem
1030 v$(0)="":for i=1 to 24:v$(i)=v$(i-1)+"":next
1047 rem
1048 rem wing table
1049 rem
1050 for i=0 to 11:for k=0 to 4:read a:w(i,k)=a:next:next
1060 data 0,2,0,0,1
1061 data 1,3,1,0,1
1062 data 2,2,0,2,3
1063 data 3,3,1,2,3
1064 data 4,4,4,4,5
1065 data 5,5,5,4,5
1066 data 6,8,6,6,7
1067 data 7,7,7,6,7
1068 data 8,8,6,8,8
1069 data 9,11,9,9,10
1070 data 10,10,10,9,10
1071 data 11,11,9,11,11
1072 rem
1073 rem screen code/ascii conversion
1074 rem
1075 for i=0 to 31:ch$(i)=chr$(i+64):next:for i=32 to 63:ch$(i)=chr$(i):next
1076 for i=0 to 63:ch$(i)=""+ch$(i)+"[146]":next
1077 rem
1078 rem room name table
1079 rem
1080 for i=1 to 52:read a$:nm$(i)=a$:next:for i=53 to 61:nm$(i)="doorway":next
1081 nm$(62)=nm$(1):nm$(63)=nm$(1)
1082 data "stairway","water closet","closet","crawl space","portico","porch"
1083 data "lawn","balcony","hallway","parlor","dining room","conservatory"
1084 data "kitchen","laundry","pantry","family parlor","ball room","study"
1085 data "library","tea garden","greenhouse","deck","hot tub","garage"
1086 data "billiard room","den","workshop","furnace room","chauffer's room"
1087 data "maid's room","butler's room","sauna","tapestry room"," "
1088 data "wyeth room","nursery","picasso room","vermeer room","dressing room"
1089 data "van gogh room","library balcony","computer room","train room"
1090 data "play room","freddy's room","cecil's room","amy's room"
1091 data "governess's cupboard","school room","studio","high balcony"
1092 data "secret room"
1097 rem
1098 rem set initial values
1099 rem
1100 for i=0 to 5:pf$(i)="@[146][149]":next:for i=0 to 5:read a$:pf$(i)=a$+pf$(i):next
1105 data "[129]","[151]","","[154]","","[155]"
1110 bl$=" "
1115 for i=0 to 5:read a:sh(i)=a:next
1116 data 5,9,13,17,21,25
1120 for i=0 to 5:h(i)=sh(i):v(i)=15:pw(i)=0:xh(i)=h(i):xv(i)=v(i):next
1125 for i=0 to 5:xc(i)=peek(da(pw(i))+h(i)+40*v(i))-128:xc$(i)=ch$(xc(i)):next
1127 rem
1128 rem get player number
1129 rem
1130 print v$(24)"how many players? (1-6) ";:poke 197,64:poke 198,0
1135 get a$:if a$="" then 1135
1140 if asc(a$)<49 or asc(a$)>54 then 1135
1145 np=val(a$)-1:print v$(24)bl$v$(24)np+1" players--is this right? (y or n)";
1150 poke 197,64:poke 198,0
1155 get a$:if a$="" then 1155
1160 if a$<>"y" then 1130
1170 sp=1+int(3*rnd(9)):if sp<1 or sp>3 then 170
1180 poke 792,193:poke 808,239
1185 for i=23 to 0 step-1:print v$(i)tab(39)"!";:next
1190 return
49997 rem
49998 rem set up display
49999 rem
50000 dim db(11),dm(11),da(11):poke 53281,7:poke 53280,11:poke 657,128
50005 uq=peek(32766):vq=peek(32767)
50007 rem
50008 rem set up color memory
50009 rem
50010 print "[149][147]";:for i=0 to 23:print"please find the murderer in the mansion"
50020 next
50027 rem
50028 rem set video mem & char mem
50029 rem
50030 vm=2:vb=16384:cm=14:cb=vb+cm*1024:for i=0 to 11:dm(i)=cm+16*(i+2):next
50040 vr=53272:zq=peek(vr)
50047 rem
50048 rem set basic pointers
50049 rem
50050 for i=0 to 11:db(i)=int((vb+1024*(i+2))/256):next
50055 for i=0 to 11:da(i)=db(i)*256:next
50060 br=648:yq=peek(br)
50067 rem
50068 rem get old video pointers
50069 rem
50070 wq=peek(56578):xq=peek(56576)
50077 rem
50078 rem set load flag
50079 rem
50080 q9=q8
50088 rem get screen display & char set
50089 rem
50090 load "display data",8,1
50093 rem
50094 rem note: loading sends program back to beginning
50095 rem
50099 rem